# -*- coding: cp932 -*-
'''
Created on 2012/04/22

@author: rusyou
'''

class Singleton(object):
    '''
    classdocs
    '''
    def __new__(cls, *args, **kwargs):
        tmpInstance = None
        if not hasattr(cls, "_instanceDict"):
            cls._instanceDict = {}
            cls._instanceDict[str(hash(cls))] = super(Singleton, cls).__new__(cls, *args, **kwargs)
            tmpInstance = cls._instanceDict[str(hash(cls))]
        elif not hasattr(cls._instanceDict, str(hash(cls))):
            cls._instanceDict[str(hash(cls))] = super(Singleton, cls).__new__(cls, *args, **kwargs)
            tmpInstance = cls._instanceDict[str(hash(cls))]
        else:
            tmpInstance = cls._instanceDict[str(hash(cls))]
        return tmpInstance

    def __init__(self, *args, **kwargs):
        pass

